#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef pair < int , int > pii;
typedef vector < int > vec;
typedef vector < pii > veg;
typedef long long ll;
typedef double db;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch =='-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2e5 + 10;

namespace lct {
    int siz[N],fa[N],ch[N][2],stk[N],top,lz[N];
    inline void pu(int x) { siz[x] = siz[ch[x][0]] + siz[ch[x][1]] + 1; }
    inline void pd(int x) { if(lz[x]) lz[ch[x][0]] ^= 1,lz[ch[x][1]] ^= 1,swap(ch[x][0],ch[x][1]),lz[x] = 0; }
    inline bool ir(int x) { return ch[fa[x]][0] != x && ch[fa[x]][1] != x; }
    inline void Rotate(int x) {
	int y = fa[x],z = fa[y],k = ch[y][1] == x;
	if(!ir(y)) ch[z][ch[z][1] == y] = x; fa[x] = z;
	if(ch[x][k ^ 1]) fa[ch[x][k ^ 1]] = y; ch[y][k] = ch[x][k ^ 1];
	fa[y] = x; ch[x][k ^ 1] = y; pu(y); pu(x);
    }
    inline void Splay(int x) {
	top = 0; stk[++top] = x; for(int t = x;!ir(t);t = fa[t]) stk[++top] = fa[t]; while(top) pd(stk[top--]);
	while(!ir(x)) {
	    int y = fa[x],z = fa[y];
	    if(!ir(y)) (ch[y][0] == x) ^ (ch[z][0] == y) ? Rotate(x) : Rotate(y);
	    Rotate(x);
	} pu(x);
    }
    inline void access(int x) { for(int y = 0;x;y = x,x = fa[x]) Splay(x),ch[x][1] = y,pu(x); }
    inline void makeroot(int x) { access(x); Splay(x); lz[x] ^= 1; }
    inline int frt(int x) { access(x); Splay(x); pd(x); while(ch[x][0]) x = ch[x][0],pd(x); Splay(x); return x; } 
    inline void link(int x,int y) { makeroot(x); if(frt(y) != x) fa[x] = y; }
    inline void cut(int x,int y) { makeroot(x); if(frt(y) == x && fa[y] == x && !ch[y][0]) fa[y] = ch[x][1] = 0,pu(x); }
}

int p[N],n;

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in; for(int i = 1;i <= n;i++) p[i] = in;
    for(int i = 1;i <= n;i++) if(p[i] + i <= n) lct :: link(i,p[i] + i); else lct :: link(i,n + 1);
    int m = in;
    while(m--) {
	int op = in,i = in + 1,j;
	if(op == 1) {
	    lct :: makeroot(i); lct :: access(n + 1); lct :: Splay(n + 1); printf("%d\n",lct :: siz[n + 1] - 1);
	} else {
	    j = in; lct :: cut(i,p[i] + i > n ? n + 1 : p[i] + i); p[i] = j; lct :: link(i,p[i] + i > n ? n + 1 : p[i] + i);
	}
    } return 0;
}
